//
//  UserModel.swift
//  baihuiju
//
//  Created by 赵家彬 on 2018/6/7.
//  Copyright © 2018年 赵家彬. All rights reserved.
//

import UIKit

class UserModel: NSObject, NSCoding {

    var uid:String = ""
    var name:String = ""
    var idcard:String = ""
    var mobile:String = ""
    var password:String = ""
    var address:String = ""
    var balance:String = ""
    var frozen:String = ""
    var fund:String = ""
    var addtime:String = ""
    var recommond:String = ""
    var img:String = ""
    var realname:String = ""
    var accrual:String = ""
 
    override init() {
        super.init()
    }
    
    func encode(with aCoder: NSCoder) {
        aCoder.encode(uid, forKey: "uid")
        aCoder.encode(name, forKey: "name")
        aCoder.encode(idcard, forKey: "idcard")
        aCoder.encode(mobile, forKey: "mobile")
        aCoder.encode(password, forKey: "password")
        aCoder.encode(address, forKey: "address")
        aCoder.encode(balance, forKey: "balance")
        aCoder.encode(frozen, forKey: "frozen")
        aCoder.encode(fund, forKey: "fund")
        aCoder.encode(addtime, forKey: "addtime")
        aCoder.encode(recommond, forKey: "recommond")
        aCoder.encode(img, forKey: "img")
        aCoder.encode(realname, forKey: "realname")
        aCoder.encode(accrual, forKey: "accrual")
    }
    
    required init?(coder aDecoder: NSCoder) {
        uid = (aDecoder.decodeObject(forKey: "uid") as? String) ?? ""
        name = (aDecoder.decodeObject(forKey: "name") as? String) ?? ""
        idcard = (aDecoder.decodeObject(forKey: "idcard") as? String) ?? ""
        mobile = (aDecoder.decodeObject(forKey: "mobile") as? String) ?? ""
        password = (aDecoder.decodeObject(forKey: "password") as? String) ?? ""
        address = (aDecoder.decodeObject(forKey: "address") as? String) ?? ""
        balance = (aDecoder.decodeObject(forKey: "balance") as? String) ?? ""
        frozen = (aDecoder.decodeObject(forKey: "frozen") as? String) ?? ""
        fund = (aDecoder.decodeObject(forKey: "fund") as? String) ?? ""
        addtime = (aDecoder.decodeObject(forKey: "addtime") as? String) ?? ""
        recommond = (aDecoder.decodeObject(forKey: "recommond") as? String) ?? ""
        img = (aDecoder.decodeObject(forKey: "img") as? String) ?? ""
        realname = (aDecoder.decodeObject(forKey: "realname") as? String) ?? ""
        accrual = (aDecoder.decodeObject(forKey: "accrual") as? String) ?? ""
        super.init()
    }
    
}
